feat: GeoIP support#315
Draft
hhvrc wants to merge 1 commit into
Draft
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds GeoIP-based IP enrichment (ASN org, VPN heuristic, country/city) and stores/returns this metadata alongside login sessions.
Changes:
- Add
IpEnrichmentService(MaxMind GeoLite2 ASN/City DB support) plus related options/interfaces/data model. - Extend session creation/storage/response mapping to include enrichment fields (
AsnOrg,IsVpn,CountryCode,City). - Wire up DI + configuration registration and call enrichment during session creation.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| Directory.Packages.props | Adds central package version for MaxMind.GeoIP2. |
| Common/Common.csproj | Adds MaxMind.GeoIP2 package reference to Common. |
| Common/Services/Geo/IIpEnrichmentService.cs | Introduces enrichment service abstraction. |
| Common/Services/Geo/IpEnrichmentService.cs | Implements GeoLite2 DB loading + enrichment logic + VPN heuristic. |
| Common/Services/Geo/IpEnrichmentData.cs | Adds enrichment DTO/record. |
| Common/Options/GeoOptions.cs | Adds configuration options for GeoLite2 DB paths. |
| Common/Extensions/ConfigurationExtensions.cs | Adds RegisterGeoOptions() builder extension. |
| Common/OpenShockServiceHelper.cs | Registers IIpEnrichmentService in DI. |
| Common/OpenShockControllerBase.cs | Enriches remote IP and passes enrichment into session creation. |
| Common/Services/Session/ISessionService.cs | Extends CreateSessionAsync signature to accept optional enrichment. |
| Common/Services/Session/SessionService.cs | Persists enrichment fields into LoginSession. |
| Common/Redis/LoginSessions.cs | Adds enrichment fields to Redis session model. |
| API/Program.cs | Registers geo options during API startup. |
| API/Models/Response/LoginSessionResponse.cs | Exposes enrichment fields in API session response. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
201
to
204
| services.AddScoped<IConfigurationService, ConfigurationService>(); | ||
| services.AddScoped<ISessionService, SessionService>(); | ||
| services.AddSingleton<IIpEnrichmentService, IpEnrichmentService>(); | ||
| services.AddHttpClient<IWebhookService, WebhookService>(client => |
Comment on lines
+64
to
+66
| string? asnOrg = null; | ||
| bool isVpn = false; | ||
|
|
Comment on lines
+3
to
+6
| public sealed class GeoOptions | ||
| { | ||
| public const string SectionName = "Geo"; | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.